<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>对象解构</title>
  </head>
  <body>
    <script type="text/javascript">
      // 对象解构允许我们使用变量的名字匹配对象的属性 匹配成功 将对象属性的值赋值给变量

      let person = { name: "lisi", age: 30, sex: "男" };

      let { name: star, age: num, sex: nan } = person;
      console.log(star);
      console.log(num);
      console.log(nan);

      // let { name, age, sex } = person;
      // console.log(name)
      // console.log(age)
      // console.log(sex)

      // let {name: myName} = person;
      // console.log(myName)
    </script>
  </body>
</html>
